package aufgabenserie_1;

import java.text.NumberFormat;
import java.util.Locale;

public class CharAmount implements Comparable<CharAmount>{
	Character c;
	int count;
	int letterCount;
	NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
	
	public CharAmount( Integer count, Character c, int letterCount) {
		this.c = c;
		this.count = count;
		this.letterCount = letterCount;
		nf.setMaximumFractionDigits(2);
	} 
	
	@Override
	public int compareTo(CharAmount o) {
		if(o.count - count == 0) return 1;
		else return o.count - count;
	}
	
	@Override
	public String toString() {
		return String.format("%s", c)+" count:" + count + " percentage:" + nf.format(100*count/(letterCount*1.0));
	}
	
	

}
